home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / HCAL-27 / CW.BAS (.txt) < prev    next >
Encoding:
GW-BASIC  |  1997-02-24  |  6.3 KB  |  240 lines

  1. 10  'CW - 5 SEP 87 rev. 24 FEB 97
  2. 20  CLS:KEY OFF
  3. 30  IF EX$=""THEN EX$="EXIT"
  4. 40  COLOR 7,0,1
  5. 50  UL$=STRING$(80,205)
  6. 60  X$=STRING$(79,32)
  7. 70  DIM C$(90,3)
  8. 80  GOTO 260
  9. 90  '
  10. 100  RESTORE
  11. 110  FOR Z=42 TO 90:C$(Z,1)=CHR$(Z):READ Z$:C$(Z,2)=" "+Z$
  12. 120  IF Z$="*"THEN D$="p10":GOTO 210
  13. 130  L=LEN(Z$):D$=""
  14. 140  FOR X=1 TO L
  15. 150  M$=MID$(Z$,X,1)
  16. 160  IF M$="."THEN N$=K$+"30p30"
  17. 170  IF M$="-"THEN N$=K$+"10p30"
  18. 180  D$=D$+N$
  19. 190  NEXT X
  20. 200  L=LEN(D$)-1:MID$(D$,L,1)="1"
  21. 210  C$(Z,3)=D$
  22. 220  NEXT Z
  23. 230  C$(42,1)="END":C$(45,1)="<UNK! {00F7}>"
  24. 240  RETURN
  25. 250  '
  26. 260  CLS
  27. 270  COLOR 15,2,1
  28. 280  PRINT " MORSE CODE TRAINER";TAB(57)"by George Murphy VE3ERP ";
  29. 290  COLOR 1,0:PRINT STRING$(80,223);
  30. 300  COLOR 7,0
  31. 310  GOSUB 1730
  32. 320  PRINT UL$;
  33. 330  PRINT " Press letter in < > to:"
  34. 340  PRINT UL$;
  35. 350  PRINT "  <c> Copy code in key of C (523 Hz)"
  36. 360  PRINT "  <d> Copy code in key of D (587 Hz)"
  37. 370  PRINT "  <e> Copy code in key of E (659 Hz)"
  38. 380  PRINT "  <f> Copy code in key of F (698 Hz)"
  39. 390  PRINT "  <g> Copy code in key of G (784 Hz)"
  40. 400  PRINT "  <h> Display Morse Code Character Set"
  41. 410  PRINT
  42. 420  PRINT "  <z> EXIT";
  43. 430  K$=INKEY$:IF K$=""THEN 430
  44. 440  GOSUB 100
  45. 450  IF K$="z"THEN CLS:RUN EX$
  46. 460  Z=ASC(K$):IF Z>98 AND Z<105 THEN 490
  47. 470  GOTO 430
  48. 480  '
  49. 490  '.....start
  50. 500  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  51. 510  IF K$="h"THEN 1420
  52. 520  GOSUB 1970
  53. 530  PRINT UL$;
  54. 540  FOR Z=1 TO 9:PRINT TAB(8)"<";Z;"> EQV";
  55. 550  PRINT USING"###.# WPM";2.5+2.5*Z:NEXT Z
  56. 560  PRINT TAB(5)"or < 0 > to EXIT...."
  57. 570  Z$=INKEY$:IF Z$=""THEN 570 ELSE S=ASC(Z$)
  58. 580  IF Z$="0"THEN CLS:END
  59. 590  IF S<48 OR S>57 THEN 570 ELSE S=S-48
  60. 600  SP=2.5*(S+1):S$=STR$(25*(S+1)):PLAY"MLO3t"+S$
  61. 610  CLS:PRINT " Press number in < > to:
  62. 620  PRINT UL$;
  63. 630  PRINT "  <1> Copy a message or series of characters"
  64. 640  PRINT "  <2> Copy random 5-character groups"
  65. 650  PRINT "  <3> Learn Morse characters"
  66. 660  Z$=INKEY$
  67. 670  IF Z$="1"THEN 720
  68. 680  IF Z$="2"THEN 890
  69. 690  IF Z$="3"THEN 1580
  70. 700  GOTO 660
  71. 710  '
  72. 720  '.....send characters
  73. 730  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  74. 740  PRINT
  75. 750  PRINT " ENTER MESSAGE (no commas please!) or ENTER <0> to return to Menu"
  76. 760  PRINT
  77. 770  INPUT Z$
  78. 780  IF Z$="0"THEN 260
  79. 790  CLS:COLOR 7,0,0
  80. 800  FOR Z=1 TO LEN(Z$)
  81. 810  Y=ASC(MID$(Z$,Z)):IF Y>96 AND Y<123 THEN Y=Y-32
  82. 820  PLAY C$(Y,3)
  83. 830  PRINT CHR$(Y);
  84. 840  NEXT Z:PRINT ""
  85. 850  PRINT UL$;
  86. 860  PRINT " Speed selected: about";SP;"WPM."
  87. 870  GOTO 1240
  88. 880  '
  89. 890  '.....generate groups
  90. 900  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  91. 910  INPUT " How many of 5-character groups ......";N
  92. 920  DIM A$(N*5+1)
  93. 930  CLS:COLOR 7,0,0
  94. 940  RANDOMIZE TIMER
  95. 950  LOCATE 12,27:PRINT "Sending group #   1 of";N
  96. 960  T1=TIMER
  97. 970  '
  98. 980  FOR Z=1 TO N*5
  99. 990  Y=INT(RND*100)
  100. 1000  IF Y<44 OR Y>90 THEN Z=Z-1:GOTO 1050
  101. 1010  IF Y>57 AND Y<65 THEN Z=Z-1:GOTO 1050
  102. 1020  PLAY C$(Y,3):A$(Z)=C$(Y,1)
  103. 1030  IF Z/5=INT(Z/5)THEN PLAY"p5"
  104. 1040  LOCATE 12,43:PRINT USING "###";INT(1+(Z/5))
  105. 1050  NEXT Z
  106. 1060  CLS:LOCATE 12,33:PRINT ".....END....."
  107. 1070  '
  108. 1080  T2=TIMER:T=T2-T1:W=N/T*60
  109. 1090  PLAY"p3":PLAY C$(42,3)
  110. 1100  CLS:PRINT "This is what you just heard (<UNK! {00F7}> is a pause -...-):"
  111. 1110  PRINT UL$;
  112. 1120  FOR I=1 TO Z:PRINT A$(I);
  113. 1130  IF I/5=INT(I/5)THEN PRINT "   ";
  114. 1140  NEXT I:PRINT UL$;
  115. 1150  PRINT " Speed selected: about";SP;"WPM."
  116. 1160  TT=(T2-T1)/60
  117. 1170  PRINT " Transmission time:";USING "##.### minutes";TT
  118. 1180  PRINT " Actual speed (military standard) was";N;
  119. 1190  PRINT "cipher groups in";USING "####.#";T;
  120. 1200  PRINT " sec.=";TAB(72);USING "###.#";W;
  121. 1210  PRINT " WPM";
  122. 1220  ERASE A$:GOTO 1240
  123. 1230  '
  124. 1240  '.....ARRL standard speed
  125. 1250  COLOR 0,7:PRINT " Computing dots per minute.....Please Wait....."
  126. 1260  LN=CSRLIN-1
  127. 1270  PLAY"MLO6t"+S$
  128. 1280  TW1=TIMER+5:N=0     'set timer cutout at 5 seconds
  129. 1290  N=N+1:PLAY "g30p30p30":LOCATE LN,48:PRINT 60-N
  130. 1300  IF TIMER>TW1 THEN TW2=TIMER:COLOR 7,0:GOTO 1320
  131. 1310  GOTO 1290
  132. 1320  DS=N/5       'dots per second
  133. 1330  NW=2.4*DS    'words per minute
  134. 1340  LOCATE CSRLIN-1
  135. 1350  PRINT " Actual speed (A.R.R.L. standard) was";
  136. 1360  PRINT USING"####.#";N*12;
  137. 1370  PRINT" dots per minute <UNK! {00F6}> 25 =";TAB(72);USING "###.#";NW;
  138. 1380  PRINT " WPM";
  139. 1390  PRINT UL$;
  140. 1400  GOTO 2170
  141. 1410  '
  142. 1420  '.....morse characters
  143. 1430  PRINT " MORSE CODE CHARACTER SET:   (<UNK! {00F7}>) -...- denotes a pause."
  144. 1440  PRINT " "+STRING$(25,205)
  145. 1450  PRINT " ("+C$(63,1)+")";C$(63,2),
  146. 1460  FOR Z=44 TO 90
  147. 1470  IF Z>57 AND Z<65 THEN 1500
  148. 1480  IF C$(Z,1)=" *"THEN 1500
  149. 1490  PRINT " ("+C$(Z,1)+")";C$(Z,2),
  150. 1500  NEXT Z
  151. 1510  PRINT " "+C$(42,1);C$(42,2)
  152. 1520  PRINT
  153. 1530  PRINT " There are several other Morse characters, but these are the ones";
  154. 1540  PRINT " most commonly"
  155. 1550  PRINT " in amateur radio communication."
  156. 1560  GOTO 2170
  157. 1570  '
  158. 1580  '.....learn characters
  159. 1590  CLS:RANDOMIZE TIMER
  160. 1600  PRINT " Press 1 to copy a character or 0 to QUIT"
  161. 1610  Z$=INKEY$:IF Z$=""THEN 1610
  162. 1620  IF Z$="0"THEN 260
  163. 1630  IF Z$="1"THEN 1640 ELSE 1610
  164. 1640  LOCATE CSRLIN-1:PRINT X$:LOCATE CSRLIN-1
  165. 1650  Y=INT(RND*100):IF Y<44 OR Y>90 THEN 1650
  166. 1660  IF Y>57 AND Y<65 THEN 1650
  167. 1670  PLAY C$(Y,3):PRINT" Press 2 to see what you heard"
  168. 1680  IF INKEY$="2"THEN 1690 ELSE 1680
  169. 1690  LOCATE CSRLIN-1:PRINT X$:LOCATE CSRLIN-1
  170. 1700  PRINT " "+C$(Y,1)+" "+C$(Y,2)
  171. 1710  GOTO 1600
  172. 1720  '
  173. 1730  '.....preface
  174. 1740  T=7
  175. 1750  PRINT TAB(T);
  176. 1760  PRINT "This program will help you learn to copy Morse code by the British"
  177. 1770  PRINT TAB(T);
  178. 1780  PRINT "Military System. The Military sent EVERYTHING in 5-character cipher"
  179. 1790  PRINT TAB(T);
  180. 1800  PRINT "groups. Wireless operators had no way of knowing the meaning of the"
  181. 1810  PRINT TAB(T);
  182. 1820  PRINT "message, or even what language it was in. They were required ONLY"
  183. 1830  PRINT TAB(T);
  184. 1840  PRINT "to copy each character EXACTLY. There was no point in anticipating"
  185. 1850  PRINT TAB(T);
  186. 1860  PRINT "the next character or guessing one that had been missed because"
  187. 1870  PRINT TAB(T);
  188. 1880  PRINT "they could be anything. There may be easier ways to learn CW and"
  189. 1890  PRINT TAB(T);
  190. 1900  PRINT "some may even teach you how to remember it after passing some"
  191. 1910  PRINT TAB(T);
  192. 1920  PRINT "required test, but as any CW buff who learned by the Military"
  193. 1930  PRINT TAB(T);
  194. 1940  PRINT "Method will attest, once you learn it this way you never forget it."
  195. 1950  RETURN
  196. 1960  '
  197. 1970  '.....speed note
  198. 1980  T=8
  199. 1990  PRINT TAB(T);
  200. 2000  PRINT "Code speeds in this program are set in accordance with military"
  201. 2010  PRINT TAB(T);
  202. 2020  PRINT "standards whereby all messages are sent in 5-character encoded"
  203. 2030  PRINT TAB(T);
  204. 2040  PRINT "cipher groups with each cipher group logged as one word. This is a"
  205. 2050  PRINT TAB(T);
  206. 2060  PRINT "close approximation of plain English language where in normal"
  207. 2070  PRINT TAB(T);
  208. 2080  PRINT "usage the average word length is 5 letters. Speeds are also shown"
  209. 2090  PRINT TAB(T);
  210. 2100  PRINT "in WPM according to the A.R.R.L. dots-per-minute standard."
  211. 2110  PRINT UL$;
  212. 2120  PRINT " Current speed level is set at <";:COLOR 15,6:PRINT S;
  213. 2130  COLOR 7,0:PRINT ">"
  214. 2140  PRINT " To set speed level for next exercise press number in < > for:"
  215. 2150  RETURN
  216. 2160  '
  217. 2170  '.....end
  218. 2180  GOSUB 2270:CLS:GOTO 260
  219. 2190  '
  220. 2200  DATA .-.-.,*,--..--,-...-,.-.-.-,-..-.,-----
  221. 2210  DATA .----,..---,...--,....-,.....,-....,--...
  222. 2220  DATA ---..,----.,*,*,*,*,*,..--..,*,.-,-...
  223. 2230  DATA -.-.,-..,.,..-.,--.,....,..,.---,-.-,.-..
  224. 2240  DATA --,-.,---,.--.,--.-,.-.,...,-,..-,...-
  225. 2250  DATA .--,-..-,-.--,--..
  226. 2260  '
  227. 2270  'HARDCOPY
  228. 2280  GOSUB 2390:LOCATE 25,2:COLOR 14,6
  229. 2290  PRINT " Press 1 to print screen, 2 to print screen & ";
  230. 2300  PRINT "advance paper, or 3 to continue.";:COLOR 7,0
  231. 2310  Z$=INKEY$:IF Z$="3"THEN GOSUB 2390:RETURN
  232. 2320  IF Z$="1"OR Z$="2"THEN GOSUB 2390:GOTO 2340
  233. 2330  GOTO 2310
  234. 2340  FOR QX=1 TO 24:FOR QY=1 TO 80
  235. 2350  LPRINT CHR$(SCREEN(QX,QY));
  236. 2360  NEXT QY:NEXT QX
  237. 2370  IF Z$="2"THEN LPRINT CHR$(12)
  238. 2380  GOTO 2280
  239. 2390  LOCATE 25,1:PRINT STRING$(80,32);:RETURN
  240.